﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace FortuneHeaven.Admin.Common
{
    [Serializable]
    public class RoleAuth: ICloneable
    {
        public List<Module> Modules = new List<Module>();

        public object Clone()
        {
            RoleAuth temp = new RoleAuth();
            foreach (Module mo in Modules)
            {
                temp.Modules.Add((Module)mo.Clone());
            }
            return temp;
        }
    }

    [Serializable]
    public class Module : ICloneable
    {
        public string ModuleNO;
        public string Name;
        public List<Function> Functions = new List<Function>();
        [NonSerialized]
        public bool IsAuth = false;


        public object Clone()
        {
            Module temp = (Module)this.MemberwiseClone();
            temp.Functions = new List<Function>();
            foreach (Function fun in this.Functions)
            {
                temp.Functions.Add((Function)fun.Clone());
            }
            return temp;
        }
    }
    [Serializable]
    public class Function : ICloneable
    {
        public string FunctionNO;
        public string Name;
        public string URL;
        [NonSerialized]
        public bool IsAuth;

        public object Clone()
        {
            Function  func = (Function)this.MemberwiseClone();
            func.IsAuth = false;
            return func;
        }
    }
}